import { supabaseServerClient } from "supabase/serverClient"; import { PublishPost } from "./PublishPost"; import { PubLeafletPublication } from "lexicons/api"; import { getIdentityData } from "actions/getIdentityData"; import { AtpAgent } from "@atproto/api"; import { ReplicacheProvider } from "src/replicache"; export const preferredRegion = ["sfo1"]; export const dynamic = "force-dynamic"; export const fetchCache = "force-no-store"; type Props = { // this is now a token id not leaflet! Should probs rename params: Promise<{ leaflet_id: string }>; }; export default async function PublishLeafletPage(props: Props) { let leaflet_id = (await props.params).leaflet_id; let { data } = await supabaseServerClient .from("permission_tokens") .select( `*, permission_token_rights(*), leaflets_in_publications( *, publications( *, documents_in_publications(count) ), documents(*))`, ) .eq("id", leaflet_id) .single(); let rootEntity = data?.root_entity; if (!data || !rootEntity || !data.leaflets_in_publications[0]) return (
missin something
{JSON.stringify(data, undefined, 2)}
); let identity = await getIdentityData(); if (!identity || !identity.atp_did) return null; let pub = data.leaflets_in_publications[0]; let agent = new AtpAgent({ service: "https://public.api.bsky.app" }); let profile = await agent.getProfile({ actor: identity.atp_did }); return ( ); }